/**
 * DeviceScan.java [V 1.0.0]
 * classes :com.lenovo.vb10.scan.DeviceScan
 * allow.xuweibin Create in  2014年12月5日 下午8:18:36
 */
package com.dragon.blelibrary.scandevise;

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothManager;
import android.content.Context;

/**
 * com.lenovo.vb10.scan.DeviceScan
 * 
 * @author allow.xuweibin <br/>
 *         create in 2014年12月5日 下午8:18:36
 */
public abstract class DeviceScan {
    protected BluetoothAdapter mAdapter;
    protected Context mContext;

    public static final int SCAN_PERIOD_4S = 4000;
    public static final int SCAN_PERIOD_6S = 6000;
    public static final int SCAN_PERIOD_8S = 8000;
    public static final int SCAN_PERIOD_DEFAULT = 8000;

    DeviceScan(Context context) {
        mContext = context.getApplicationContext();
        BluetoothManager bManager = (BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE);
        mAdapter = bManager.getAdapter();
    }

    public abstract boolean scanDevice(long scanTime, IScanListener listener);

    public abstract void stopScanDevice();
    
    public abstract boolean isScanning();

    public abstract BluetoothDevice getDevice(String mac);

//    public interface IScanListener {
//    	/**搜索超时*/
//    	public static final int RESULT_SCAN_TIME_OUT  = 0;
//    	/**没有搜索到设备*/
//    	public static final int RESULT_SCAN_NO_DEVICE = 1;
//    	/**主动停止搜索*/
//    	public static final int RESULT_STOP_BY_HUMAN  = 2;
//    	/**在搜索中*/
//        void OnScanning();
//        /**搜索结束*/
//        void OnScanEnd(int result);
//        /**搜索到新的设备*/
//        void OnScanNewDevice(BluetoothDevice device, String name, int rssi, byte[] scanRecord);
//    }
}
